package com.siashan.toolkit.oss.core;

import com.siashan.toolkit.oss.core.enums.OssChannel;
import lombok.Data;

/**
 * Oss上传返回
 *
 * @author siashan
 * @date 2022-05-16
 * @since v1.1.0
 **/
@Data
public class OssResult {
    /**
     * 图片地址
     */
    private String url;
    /**
     * 文件名称
     */
    private String fileName;

    /**
     * 域名
     */
    private String domain;


    /**
     * 通道代码
     */
    private OssChannel ossCode;

    /**
     * 文件类型
     */
    private String fileType;

    /**
     * 文件大小 单位：Kb
     */
    private Long fileSize;

    /**
     * 文件原始名称
     */
    private String orgFilename;

    public static OssResult build(String fileName, String domain) {
        OssResult result = new OssResult();
        result.setFileName(fileName);
        result.setDomain(domain);
        result.setUrl(domain + fileName);
        return result;
    }

    public static OssResult build(String fileName, String domain, OssChannel ossCode) {
        OssResult result = new OssResult();
        result.setFileName(fileName);
        result.setDomain(domain);
        result.setUrl(domain + fileName);
        result.setOssCode(ossCode);
        return result;
    }
}
